﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <title>FileGetAttrib</title>


  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

  <link href="../css/commands.css" rel="stylesheet" type="text/css">

  <link href="../css/print.css" rel="stylesheet" type="text/css" media="print">

</head>


<body>

<h1>FileGetAttrib</h1>


<p>报告一个文件或文件夹是否为只读、隐藏等等。 </p>

<p class="CommandSyntax">FileGetAttrib, OutputVar [,
Filename]<br>

<a href="FileGetAttrib.htm#attrib">AttributeString</a>
:= <a href="../Functions.htm#FileExist">FileExist</a>(FilePattern)</p>

<h3>参数 </h3>

<table border="1" bordercolor="#c0c0c0" cellpadding="3" cellspacing="0" width="100%">

  <tbody>

    <tr>

      <td width="15%">OutputVar</td>

      <td width="85%">储存获取的文本的变量名称。</td>

    </tr>

    <tr>

      <td>Filename</td>

      <td>目标文件的名称，如果绝对路径未指定将被假设在 <a href="../Variables.htm#WorkingDir">%A_WorkingDir%</a>
。如果省略，装在 <a href="LoopFile.htm">File-Loop</a>
最内层的当前文件将被代为使用。</td>

    </tr>

  </tbody>
</table>

<h3>ErrorLevel</h3>

<p>如果发生了一个问题 <a href="../misc/ErrorLevel.htm">ErrorLevel</a>
会被设为 1 ，此外为 0 。</p>

<h3>注意</h3>

<p><a name="attrib"></a>返回的字串将包含一个在字符串
"RASHNDOCT"&nbsp;中的字母子集：<br>

<br>

R = READONLY (只读)<br>

A = ARCHIVE (存档)<br>

S = SYSTEM (系统)<br>

H = HIDDEN (隐藏)<br>

N = NORMAL (普通)<br>

D = DIRECTORY (目录)<br>

O = OFFLINE (离线)<br>

C = COMPRESSED (压缩)<br>

T = TEMPORARY (临时)</p>

<p><br>

要检查特定的属性是否在获得的字串里存在，参照此例：</p>

<pre>FileGetAttrib, Attributes, C:\My File.txt<br>IfInString, Attributes, H<br> MsgBox 文件是隐藏的。</pre>

<p>相关提示，要获取一个文件的 8.3 短名格式，参照此例：</p>

<pre><a href="LoopFile.htm">Loop</a>, C:\My Documents\Address List.txt<br> ShortPathName = %A_LoopFileShortPath% <em>; 将产生一些路径类似于 C:\MYDOCU~1\ADDRES~1.txt</em></pre>

<p>一个相似的手法能用来得到 8.3 短名格式的长文件名。</p>

<h3>相关命令</h3>

<p><a href="../Functions.htm#FileExist">FileExist()</a>,
<a href="FileSetAttrib.htm">FileSetAttrib</a>, <a href="FileGetTime.htm">FileGetTime</a>, <a href="FileSetTime.htm">FileSetTime</a>, <a href="FileGetSize.htm">FileGetSize</a>, <a href="FileGetVersion.htm">FileGetVersion</a>, <a href="LoopFile.htm">File-loop</a> </p>

<h3>示例</h3>

<pre class="NoIndent">FileGetAttrib, OutputVar, C:\New Folder</pre>

</body>
</html>
